package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.empQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    List<Clazz> ClazzList(empQueryParam empQueryParam);

    @Delete("delete from clazz where id = #{id}")
    void deleteClazz(Integer id);

    @Insert("insert into clazz(name,room,begin_date,end_date,subject,master_id,create_time,update_time) " +
            "values(#{name},#{room},#{beginDate},#{endDate},#{subject},#{masterId},#{createTime},#{updateTime})")
    void addClazz(Clazz clazz);

    @Select("select * from clazz where id = #{id}")
    Clazz getInfo(Integer id);

    void update(Clazz clazz);

    List<Clazz> getAll();

    @Select("select count(*) sum from student where clazz_id = #{id}")
   Integer checkClazz(Integer id);
}
